#!/usr/bin/python

import sys
fd=file(sys.argv[1],'r')
if fd==0:
	print "can't open %s"%sys.argv[1]
	sys.exit()

buf=fd.read()
n=len(buf)

if n > 510:
	print "boot block too large: %s bytes (max 510)"%n
	sys.exit()

print "boot block is %s bytes (max 510)"%n

fd.close()

fd=file(sys.argv[1],'w')
if fd==0:
	print "can't open %s"%sys.argv[1]
	sys.exit()
buf+="\0"*(510-n)+"\x55\xAA"
fd.write(buf)
fd.close()
